//
//  UIButton+Extension.swift
//  Ccweibo
//
//  Created by 陈锦聪 on 16/3/26.
//  Copyright © 2016年 Coco. All rights reserved.
//

import UIKit

extension UIButton {
    
    convenience init(title: String, textFont: CGFloat = textFontSmall, textColor: UIColor = UIColor.lightGrayColor(), imageName: String, bgImageName: String = "timeline_card_bottom_background") {
        self.init()
        setTitle(title, forState: UIControlState.Normal)
        titleLabel!.font = UIFont.systemFontOfSize(textFont)
        setTitleColor(textColor, forState: UIControlState.Normal)
        setImage(UIImage(named: imageName), forState: UIControlState.Normal)
        setBackgroundImage(UIImage(named: bgImageName), forState: UIControlState.Normal)
        setBackgroundImage(UIImage(named: "\(bgImageName)_highlighted"), forState: UIControlState.Highlighted)
    }
}
